package Filters;
//TODO: falta ordenar a lista de torrents!!!

import java.util.Collections;
import java.util.LinkedList;

import movie.Movie;
import movie.Torrent;

public class TorrentFilter {

	public LinkedList<Movie> filter(LinkedList<Movie> movies, int minSeeders,
			int minSize) {
	LinkedList<Movie> movies_alt=movies;
	
		for (Movie m:movies){
			LinkedList<Torrent> m_aux=new LinkedList<Torrent>();
			
			for(Torrent torrent:m.getTorrentList() ){
				if ((torrent.getSeeds()>=minSeeders) && (torrent.getSize()>=minSize)){
					m_aux.add(torrent);
				}
				Collections.sort(m_aux);
				m.setTorrentList(m_aux);
			}
		}
		return movies;
	}

}
